package com.chaofan.authsso.core.common;

import org.springframework.stereotype.Controller;

/**
 * 公用方法
 * Author: Chaofan
 * Date: 2020/6/11 17:41
 * email: chaofan2685@qq.com
 */
@Controller
public class Methods {

    public SsoRestfulMessage buildSuccessRest(Object data){
        SsoRestfulMessage ssoRestfulMessage = new SsoRestfulMessage();
        ssoRestfulMessage.setCode(Constant.SUCCESS);
        ssoRestfulMessage.setMessage(Constant.SUCCESS_MSG);
        ssoRestfulMessage.setData(data);
        return ssoRestfulMessage;
    }

    public SsoRestfulMessage buildNewToken(Object data){
        SsoRestfulMessage ssoRestfulMessage = new SsoRestfulMessage();
        ssoRestfulMessage.setCode(Constant.CREATE_NEW_TOKEN);
        ssoRestfulMessage.setMessage(Constant.CREATE_NEW_TOKEN_MSG);
        ssoRestfulMessage.setData(data);
        return ssoRestfulMessage;
    }

    public SsoRestfulMessage buildApplyToken(Object data){
        SsoRestfulMessage ssoRestfulMessage = new SsoRestfulMessage();
        ssoRestfulMessage.setCode(Constant.APPLY_TOKEN);
        ssoRestfulMessage.setMessage(Constant.APPLY_TOKEN_MESSAGE);
        ssoRestfulMessage.setData(data);
        return ssoRestfulMessage;
    }

}
